package StudyCode.summary.Basic.mystring;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class StringStartWithAndEndWith {
	public static void main(String[] args) {
		String[] strings = {"hello", "http", "world"};

		for (String string : strings) {
			if (string.startsWith("he")) {
				System.out.printf("\"%s\" starts with \"he\"\n", string);
			}
		}

		System.out.println();
		for (String string : strings) {
			if (string.startsWith("ll", 2)) {
				System.out.printf("\"%s\" starts with \"ll\" at position 2\n", string);
			}
		}

		System.out.println();
		for (String string : strings) {
			if (string.endsWith("ld")) {
				System.out.printf("\"%s\" ends with \"ld\"\n", string);
			}
		}
	}
}
